package com.rsk.service.curriculum.impl;


import java.util.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.dubbo.config.annotation.Service;
import com.rsk.dao.curriculum.RskCourseExamineRepository;
import com.rsk.dao.curriculum.RskCourseRepository;
import com.rsk.entity.curriculum.RskCourseExamine;
import com.rsk.service.curriculum.RskCourseExamineService;
import com.rsk.utils.algorithm.SnowflakeIdWorker;


@Service(interfaceClass = RskCourseExamineService.class)
public class RskCourseExamineServiceImpl implements RskCourseExamineService{
	
	@Autowired
	private RskCourseExamineRepository rskCourseExamineRepository;
	
	@Autowired
	private RskCourseRepository rskCourseRepository;
	
	@Transactional
	public int saveRskCourseExamine(Long courseId, Integer examineStatus,
			String examineRemarks, Long operatorUser) {
		RskCourseExamine rskCourseExamine = new RskCourseExamine();
		rskCourseExamine.setId(SnowflakeIdWorker.generateId(true));
		rskCourseExamine.setCourseId(courseId);
		rskCourseExamine.setExamineStatus(examineStatus);
		rskCourseExamine.setExamineRemarks(examineRemarks);
		rskCourseExamine.setIsDel(0);
		rskCourseExamine.setOperatorUser(operatorUser);
		rskCourseExamine.setOperatorTime(new Date());
		rskCourseExamineRepository.saveAndFlush(rskCourseExamine);
		rskCourseRepository.updateRskCourseStatus(courseId, examineStatus, operatorUser);
		return 1;
	}

	@Transactional
	public int delRskCourseExamine(Long id, Long operatorUser) {
		return rskCourseExamineRepository.delRskCourseExamine(id, operatorUser);
	}

	@SuppressWarnings("rawtypes")
	public List<Map> selectRskCourseExamine(Long courseId) {
		return rskCourseExamineRepository.selectRskCourseExamine(courseId);
	}

 


	
}
